package com.zziq.mianshi.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zziq.mianshi.model.dto.question.QuestionQueryRequest;
import com.zziq.mianshi.model.entity.Question;
import com.zziq.mianshi.model.vo.QuestionVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 题目服务
 */
public interface QuestionService extends IService<Question> {

    /**
     * 校验数据
     *
     * @param question
     * @param add      对创建的数据进行校验
     */
    void validQuestion(Question question, boolean add);

    /**
     * 获取查询条件
     *
     * @param questionQueryRequest
     * @return
     */
    QueryWrapper<Question> getQueryWrapper(QuestionQueryRequest questionQueryRequest);

    /**
     * 获取题目封装
     *
     * @param question
     * @param request
     * @return
     */
    QuestionVO getQuestionVO(Question question, HttpServletRequest request);

    /**
     * 分页获取题目封装
     *
     * @param questionPage
     * @param request
     * @return
     */
    Page<QuestionVO> getQuestionVOPage(Page<Question> questionPage, HttpServletRequest request);

    /**
     * @Title: listQuestionByPage
     * @Author: Mr·zziq
     * @Date: 2024-12-08 11:29:32
     * @Params: [questionQueryRequest]
     * @Return: Page<Question>
     * @Description: 分页获取题目
     */
    Page<Question> listQuestionByPage(QuestionQueryRequest questionQueryRequest);


    /**
     * @Title: searchFromEs
     * @Author: Mr·zziq
     * @Date: 2024-12-08 11:29:11
     * @Params: [questionQueryRequest]
     * @Return: Page<Post>
     * @Description: 从es查询题目
     */
    Page<Question> searchFromEs(QuestionQueryRequest questionQueryRequest);

    
    /** @Title: batchRemoveQuestion
     * @Author: Mr·zziq
     * @Date: 2024-12-08 15:19:19
     * @Params: [questionIdList] 
     * @Return: void 
     * 
     * @Description: 批量删除题目
     */
    void batchRemoveQuestion(List<Long> questionIdList);
}
